﻿using System;
using Ultima.Xna.EventSystem;
using Microsoft.Xna.Framework;
using System.Xml;
using Ultima.Xna.Input;
namespace Ultima.Xna.Graphics.UI
{
    public interface IUINode : IDisposable, IEventReceiver
    {
        bool DefaultBehaviour { get; set; }

        int Index { get; set; }
        string Name { get; }

        IUIContainerNode Parent { get; set; }
        RectangleF Bounds { get; }
        Vector2 Position { get; set; }
        Vector2 Size { get; set; }

        event ClickHandler Click;
        event MouseEnterHandler MouseEnter;
        event MouseLeaveHandler MouseLeave;
        event KeyCharHandler KeyChar;
        event EventEngineHandler Event;

        bool HitTest(float x, float y);
        bool HitTest(Vector2 position);
        void HitTest(ref float x, ref float y, out bool value);
        void CalculateRenderBounds(out RectangleF renderBounds);
        void Dispose();
        void Draw(GameTime gameTime);
        void Initialize(XmlElement element);
        bool IsRegisteredEvent(short eventId);
        void RegisterAllEvents();
        void RegisterEvent(short eventId);
        void SendEvent(object sender, int eventId, params object[] args);
        void UnregisterAllEvents();
        void UnregisterEvent(short eventId);
        void HandleMouseEnter();
        void HandleMouseLeave();
        void HandleKeyUp(KeyboardEventArgs e);
        void HandleKeyDown(KeyboardEventArgs e);
        void HandleClick(MouseButtons button, bool down);
        void HandleKeyChar(char ch);
    }
}
